﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ClassLibrary.DAO;
using ClassLibrary.Entity;

public partial class ucControl_ucItems : System.Web.UI.UserControl
{
    TblItemsDAO itemDAO = new TblItemsDAO(Global.CONNECTION_STRING);
    TblChildMenuDAO chilDAO = new TblChildMenuDAO(Global.CONNECTION_STRING);

    protected void Page_Load(object sender, EventArgs e)
    {
        string id = Request.QueryString["id"];

        if (!IsPostBack)
        {
            if (id != null)
            { 
                LoadDtailMenuChild();
                LoadRepeaterItem();
               
            }
        }
    }

    private void LoadDtailMenuChild()
    
    {
        string id = Request.QueryString["id"];
        //frmViewDetail.DataSource = ItemsDAO.GetListItems(Convert.ToInt32(id), "", "", 1, 10, "");
        frmViewDetail.DataSource = chilDAO.GetMenuChildByIDChild(Convert.ToInt32(id));
        frmViewDetail.DataBind();
    }

    private void LoadRepeaterItem()
    {
        string id = Request.QueryString["id"];
        rpItem.DataSource = itemDAO.GetItemByIDChild(Global.ConvertToInt(id));
        rpItem.DataBind();
    }
}
